source("pgload.R")
tw2330 <- getSymbols("2330.tw",auto.assign = F,warnings = T,from="2000-01-01")
names(tw2330) <- c("Open","High","Low","Close","Volume","Adjust")
tw2330 %>% head
## Open High Low Close Volume Adjust
## 2000-01-04 69.6490 69.6490 68.4752 69.6490 200662321971 39.52547
## 2000-01-05 69.6490 71.2141 68.8663 71.2141 402466776297 40.41367
## 2000-01-06 70.8229 71.2141 69.6490 69.6490 197545701266 39.52547
## 2000-01-07 67.3013 68.4752 66.5186 67.6925 235270327441 38.41517
## 2000-01-10 69.6490 70.4314 68.4752 70.0402 276171665217 39.74748
## 2000-01-11 70.8229 71.6052 68.4752 68.8663 277769524211 39.08129
tw2330 %>%
.$Close %>%
is.na() %>%
# which((.)==T)
sum -> NAvalue
tw2330 %>%
.$Close %>%
length() -> AllValue
NAvalue/AllValue # 資料損失程度
## [1] 0.01854975
na.omit(tw2330) -> tw2330
tw2330 %>%
index(tw2330) -> Date
data.frame(Date,tw2330) %>%
as.tibble() -> tw2330_DF
rm(Date)
p <- tw2330_DF %>%
# tail()
filter(Date > ymd("20180101")) %>%
ggplot(aes(Date,Close)) +
geom_line() +
labs(
title ="Trade"
)
ggplotly(p)
chart_Series(tw2330["2018"])
add_BBands()
add_MACD()
quantmod::add_EMA()
add_RSI() -> x
x
裏面太多資訊 , 想要做一個 策略判斷 logging >> 讀相關 判定